package com.example4.demo44.service;

import java.util.ArrayList;
import java.util.List;

import com.example4.demo44.bean.AppMessage;
import com.example4.demo44.mapper.AppMessageMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppMessageService {
    
    @Autowired
    private AppMessageMapper mapper;
    
    //增加
    public List<AppMessage> getMessage(){
        System.out.println("appmessage------9");
         List<AppMessage> list = new ArrayList<AppMessage>();
         list.add(mapper.selectByPrimaryKey("xtt"));
         //list = mapper.selectAll();
         return list;
    }
    
    //查看全部
    public List<AppMessage> getAllMessage(){
        System.out.println("appmessage------10");
         List<AppMessage> list = new ArrayList<AppMessage>();
         list = mapper.selectAll();
         return list;
    }

    //增加
    public int addMessage(AppMessage appMessage) {
        System.out.println("appmessage------11");
        return mapper.insert(appMessage);
    }

    //改
    public List<AppMessage> getMessageById(String id) {
        System.out.println("appmessage------12");
        return mapper.getMessById(id);
    }

    //删除
    public int delMessage(String id) {
        System.out.println("appmessage------13");
        return mapper.deleteByPrimaryKey(id);
    }
    
    
    
}